$$HEADER$$
<h3>Using <b>eLua</b> with the LM3S (Cortex-M3) CPUs from Luminary Micro</h3>
 <p><a href="http://www.luminarymicro.com">Luminary Micro</a> is the company that produced the world's first silicon implementation of the Cortex-M3 processor. Their 
 device portfolio is quite impressive, ranging from relatively simple devices to full-featured CPUs (with on-chip USB, EMAC, CAN, and many other peripherals). The support
 package for these devices is also very good, with drivers for all the CPU peripherals and ports of 3rd party applications. And, on a personal note, I contacted Luminary Micro
 some while ago with a request to support this project with one of their evaluation kits, and their response was excellent (thanks again, Luminary!). That's how a
 <a href="http://www.luminarymicro.com/products/lm3s8962_can_ethernet_evaluation_kit.html">EKx-LM3S8962K</a> landed on my desk. This is the development board that I'm going
 to use in this tutorial. <b>eLua</b> also supports the <a href="http://www.luminarymicro.com/products/ekk-lm3s6965_ethernet_evaluation_kit.html">EKx-LM3S6965</a> board from Luminary (which can be programmed exactly like the EKx-LM3S8962) and the <a href="http://www.micromint.com/index.php/SBC/eagle-100.html">Eagle 100</a> board from <a href="http://www.micromint.com">Micromint</a>, which uses a different installation procedure. 
</p>
 <h3>Pre-requisites</h3> 
 <p>Before you'll be able to use <b>eLua</b> on the LM3S CPU, make sure that:</p>
 <ul>
 <li>you're using Windows. Yes, I really said <b>Windows</b>. The reason is quite simple: we're going to use Luminary's tools to burn <b>eLua</b> to the board,
 and they're Windows specific. This is the case with many CPUs and vendors out there. You can have Windows installed on your HDD, or under 
 an emulator in Linux, it doesn't matter, you can even try to run it from <a href="http://www.winehq.org/">Wine</a> if you're really, really brave. I'm using XP, Vista should work too.</li>
 <li>you have installed the LM Flash Programmer tool from Luminary. Look for it on <a href="http://www.luminarymicro.com/products/ekk-lm3s8962_can_ethernet_evaluation_kit.html">this page</a>,
 for example (the link is in the "Software updates" table).</li>
 <li>you already have your <b>eLua</b> image for the LM3S8962 CPU (<a href="building.html">built</a> or <a href="downloads.html">downloaded</a>). </li>
 </ul>
 <h3>Installing <b>eLua</b> on EKx-LM3S8962EK and EKx-LM3S6965</h3>
 <p>Fortunately, this is as easy and painless as possible. One of the nicest things about these two kits is they use the on-board USB port for both firmware downloading and for
 emulating a serial port (via a hardware USB to UART converter, so you don't need any special software on the CPU to access this UART port). Moreover, it automagically
 knows how (and when) to switch from the firmware download mode to the UART emulation mode, so you don't need to move jumpers around or anything like this. It's zero effort
 firmware upgrading at its best. So, let's do it:</p>
 <ul>
 <li>connect your board to your PC using a suitable USB cable. If you didn't install the board drivers yet, you'll be asked to install them now.</li>
 <li>if you're already using the USB connection on the board in the UART emulation mode, close your terminal program (or at least disconnect it from the USB COM port).</li>
 <li>fire up the "Luminary Micro Flash Programmer" application.</li>
 <li>in the "Configuration" tab, select "LM3S8962 Ethernet and CAN Evaluation board" or "LM3S6965 Ethernet Evaluation Board" (depending on your board).</li>
 <li>in the "Program" tab, select the <b>eLua</b> .bin file that you got from the compilation step.</li>
 <li>select the "Options" as you like (I generally choose "Erase entire flash" and "Reset MCU after program").</li>
 <li>hit the "Program" button.</li>
 <li>wait until programming is over, then exit the flash programmer application.</li>
 </ul>
<p>It's worth to mention that since these boards come with an USB to JTAG converter it should be possible to use OpenOCD (or a similar package) instead of the Luminary tool to program the image. The Luminary Micro forums are a good place to look for information if you're exploring the OpenOCD option.
</p>
<h3>Installing eLua on Eagle 100</h3>
<p>The Eagle 100 board can also be programmed via JTAG, but it doesn't include an on-board USB to JTAG adapter, so you'd need an external adapter if you
want to use JTAG for programming. Fortunately, it also comes with an Ethernet bootloader, so you can upload your image via Ethernet. The only requirement
to use the bootloader is to start your image at address 0x2000 instead of the usual 0x0, since that's where the bootloader jumps. The 
<a href="building.html">eLua build system</a> does this automatically if the "board=eagle-100" parameter is given at build time.<br>
For a full description of the Ethernet bootloader consult the <a href="http://www.micromint.com/index.php/Download-document/32-Eagle-100-User-s-Manual.html">Eagle 100 board manual</a>, (look for section 2.7, <b>Firmware Updates using the Ethernet Bootloader</b>).<br />
You still need the LM Flash Tool to use the Ethernet bootloader, but since the board can use JTAG for firmware uploading, it should be possible to use it 
with OpenOCD (or a similar package) and an external USB to JTAG adapter. The Luminary Micro forums are a good place to look for information if you're exploring the OpenOCD option.
</p>
$$FOOTER$$

